package com.tanhua.interceptor;

import com.tanhua.domain.Admin;

//将对象放入threadlocal
public class AdminHolder {

    private static ThreadLocal<Admin> tl=new ThreadLocal<Admin>();

    // 将User放入threadlocal的方法
    public static void saveAdmin(Admin admin){
        tl.set(admin);
    }

    // 将User从threadlocal取出方法
    public static Admin getAdmin(){
        return tl.get();
    }

    //将User从threadlocal删除方法
    public static void remove(){
        tl.remove();
    }
}
